<template>
	<view class="moneyHistory">
		<view class="list" v-if="list.length > 0">
			<view class="li" v-for="(item, index) of list" :key="index">
				<view class="month">
					<text class="txt1 font_blod">1{{item.periodMonth}}</text>
					<text class="txt2 font_blod">月</text>
					<image v-if="item.isshow" @click="cli_li(item, index)" src="../../static/manufacturers/top.png" mode=""></image>
					<image v-else @click="cli_li(item, index)" src="../../static/manufacturers/btm.png" mode=""></image>
				</view>
				<view class="content">
					<view class="left">
						<view class="title">
							结算
						</view>
						<view class="time">
							{{item.createTime}}
						</view>
					</view>
					<view class="right font_blod">
						{{item.agentSettleMoney}}
					</view>
				</view>
			</view>
		</view>
		<view class="" v-else>
			<view class="yPopNone" style="margin-top: 20%;">
				<image class="yPopNoneImg" src="https://www.zzzsyh.com/applets/agent/factory/23.png" mode="">
				</image>
				<view class="yPopNoneTxt">
					暂无结算历史~
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import allapi from '../../api/index.js'
	export default {
		data() {
			return {
				agentId: uni.getStorageSync('agentId'),
				list: []
			}
		},
		mounted() {
			this.getServiceSettleHistory()
		},
		methods: {
			// 点击展示
			cli_li (item, index) {
				item.issgow = !item.isshow
			},
			// 获取列表
			getServiceSettleHistory () {
				uni.request({
					url: allapi.getServiceSettleHistory,
					data: {
						agentId: this.agentId
					},success: (res) => {
						console.log('结算历史',res);
						let dat = res.data.data
						let lis = []
						dat.map( e => {
							lis.push(
								Object.assign(e, {isshow: false})
							)
						})
						this.list = lis
					}
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.moneyHistory {
		.list {
			.li {
				margin: 24rpx;
				padding: 0 32rpx 20rpx 32rpx;
				background: #FFFFFF;
				border-radius: 24rpx;

				.month {
					.txt1 {
						font-size: 60rpx;
						color: #333333;
						line-height: 84rpx;
					}

					.txt2 {
						font-size: 28rpx;
						color: #333333;
						line-height: 40rpx;
						margin-left: 18rpx;
					}

					image {
						width: 24rpx;
						height: 24rpx;
					}
				}

				.content {
					height: 120rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;

					.left {
						.title {
							font-size: 28rpx;
							color: #333333;
							font-weight: 400;
							line-height: 40rpx;
						}

						.time {
							line-height: 34rpx;
							color: #999999;
							font-weight: 400;
							font-size: 24rpx;
							margin-top: 8rpx;
						}
					}

					.right {
						font-size: 32rpx;
						color: #333333;
						line-height: 44rpx;
					}
				}
			}
		}
	}
</style>
